<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>伯俊微后台</title>
    <link rel="stylesheet" href="assets/css/icon-font.min.css">
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/search_box.css">
    <link rel="stylesheet" href="assets/css/style.css">
    <link rel="stylesheet" href="assets/css/isshop.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">


    <style>

        #shht {
            box-shadow: 0 0 7px #c8c8c8;
            display: none;
        }


    </style>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        a {
            text-decoration: none;
        }

        a:hover {
            text-decoration: none;
        }


        .tcdPageCode a {
            display: inline-block;
            color: #428bca;

            height: 25px;
            line-height: 25px;
            padding: 0 10px;
            border: 1px solid #ddd;
            margin: 0 2px;
            border-radius: 4px;
            vertical-align: middle;
        }

        .tcdPageCode a:hover {
            text-decoration: none;
            border: 1px solid #428bca;
        }

        .tcdPageCode span.current {
            display: inline-block;
            height: 25px;
            line-height: 25px;
            padding: 0 10px;
            margin: 0 2px;
            color: #fff;
            background-color: #428bca;
            border: 1px solid #428bca;
            border-radius: 4px;
            vertical-align: middle;
        }

        .tcdPageCode span.disabled {
            display: inline-block;
            height: 25px;
            line-height: 25px;
            padding: 0 10px;
            margin: 0 2px;
            color: #bfbfbf;
            background: #f2f2f2;
            border: 1px solid #bfbfbf;
            border-radius: 4px;
            vertical-align: middle;
        }

        .table > tbody > tr > td {

            line-height: 50px;
            background-color: #7e7e7e57;

        }

        .btlogin {
            text-decoration: none;
            background: #2668ac;
            color: #f2f2f2;

            padding: 10px 20px 10px 20px;
            margin-left: 2%;
            font-size: 16px;
            font-family: 微软雅黑, 宋体, Arial, Helvetica, Verdana, sans-serif;
            font-weight: bold;
            border-radius: 3px;

            -webkit-transition: all linear 0.30s;
            -moz-transition: all linear 0.30s;
            transition: all linear 0.30s;
        }

        select {
            width: 30%;
            height: 34px;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        .sdiv {
            float: left;
            margin: 2% 3% 0 2%;
            font-size: 20px;
            width: 9%;
        }

        .query_list {
            margin-left: -2%;
            margin-right: -2%;
            text-align: center;
        }

        .query_list div {

            margin: 0;
        }

        .query_list input {
            width: 60%;
            margin-top: 2%;
            margin-bottom: 2%;
            border: 1px solid #ccc;
            border-radius: 4px;
            text-align: center;
        }

    </style>
</head>

<body style="font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft">

<div id="wrapper">

    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="brand" style="overflow: hidden;width: 12.6%;">

                <h2 style="color: #fcfdfd">控制台</h2>

        </div>
        <div class="container-fluid">
            <div class="navbar-btn">
                <button type="button" class="btn-toggle-fullwidth">
                    <i class="lnr lnr-arrow-left-circle"></i>
                </button>
            </div>
            <form class="navbar-form navbar-left" style="margin-bottom: 0;">
                <div style="line-height: 50px;font-weight: bold;">
                    <a href="index.html"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;;">总览</a>
                    <a href="javascript:void(0);" id="shht-sj"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;">
                        商户后台
                        <span class="fa fa-angle-down"
                              style="font-size:25px;position: absolute;margin: 12px 0 0 2px;">  </span>
                    </a>
                    <a href="bos-config.html"
                       style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;">系统设置</a>
                    <a href="wechat-index.html" style="display: block;float: left;padding: 0 15px;margin: 0 10px;cursor: pointer;padding-bottom: 10px;">微生活</a>
                </div>
            </form>
            <div id="shht"
                 style="width: 500px;height: 300px;position: absolute;top: 67px;left: 100px;background-color: #fcfdfd">

                <div style="margin-left: 180px;">
                    <h4 style=" margin: 40px 0 22px 35px; color: black; font-size: 15px;">
                        <b>会员管理</b></h4>
                    <ul style="list-style:none;font-size: 12px;margin: 20px 0 30px 35px;">
                               <li style="margin: 15px 0 0 0;"><a href="vip-wx.html">会员列表</a></li>
                        <li style="margin: 15px 0 0 0;"><a href="vip-label.html">会员标签</a></li>
                       <!-- <li style="margin: 15px 0 0 0;"><a href="#">会员列表</a></li>-->
                    </ul>
                </div>

                <div style="margin-left: 70px;margin-top: -148px;">
                    <h4 style=" margin: 62px 0 22px 35px; color: black; font-size: 15px;">
                        <b>门店管理</b></h4>
                    <ul style="list-style:none;font-size: 12px;margin: 20px 0 30px 35px;">
                         <li style="margin: 15px 0 0 0;"><a href="store.html">门店列表</a></li>
                                                               <!-- <li style="margin: 15px 0 0 0;"><a href="#">门店体系</a></li>
                         <li style="margin: 15px 0 0 0;"><a href="#">门店状态</a></li>-->
                    </ul>
                </div>
                <div style="margin-left: 70px;">
                    <h4 style=" margin: 62px 0 22px 35px; color: black; font-size: 15px;">
                        <b>营销活动</b></h4>
                    <ul style="list-style:none;font-size: 12px;margin: 20px 0 30px 35px;">
                        <li style="margin: 15px 0 0 0;"><a href="coupon-y.html">优惠券</a></li>
                        <li style="margin: 15px 0 0 0;"><a href="activity.html">活动管理</a></li>
                    </ul>
                </div>

            </div>
            <div class="navbar-menu">
                <ul class="nav navbar-nav navbar-right">

                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <!--<img src="assets/images/parson.png" class="img-circle" alt="parson-img">-->
                            <span style="font-size: 15px;color: #000;">账户信息</span>
                            <i class="icon-submenu fa fa-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="#"><i class="lnr lnr-user"></i> <span>账户信息</span></a></li>
                            <li><a href="change-password.html"><i class="lnr lnr-cog"></i> <span>修改密码</span></a></li>
                            <li id="e-exit"><a href="#"><i class="lnr lnr-envelope"></i> <span>退出登录</span></a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>

    </nav>

    <div id="sidebar-nav" class="sidebar">
        <div class="sidebar-scroll">
            <h3 style="color: #ffffff;padding: 0 0 0 8%">优惠券</h3>
            <nav>
                <ul class="nav">
                    <li>
                        <a href="coupon-y.html">
                            <span style="padding: 0 0 0 30px;">优惠券管理</span>
                        </a>
                    </li>

                    <li>
                        <a href="coupon-t.html">
                            <span style="padding: 0 0 0 30px;">优惠券类型</span>
                        </a>
                    </li>
                    <li class="active">
                        <a href="coupon-batch-add.html">
                            <span style="padding: 0 0 0 30px;">批量添加</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>

    <div class="main">
        <h1 style="margin-bottom: 2%;">批量添加优惠券</h1>

        <div style="text-align: left;padding-right: 2%; margin-bottom: 5%;height: 100px">

            <div style="position: relative">
                <div style="margin: 2%;font-size: 20px;">选择添加条件：</div>
                <div style="margin: 2%;width: 90%;">

                    <form id="form-query">
                        <div style="float: left" class="query_list">
                            <div>卡号</div>
                            <div>
                                <input type="text" id="code" name="code">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>vip类型</div>
                            <div>
                                <input type="text" id="type" name="type">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>开卡店仓</div>
                            <div>
                                <input type="text" id="store" name="store">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>姓名</div>
                            <div>
                                <input type="text" id="name" name="name">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>生日</div>
                            <div>
                                <input type="text" id="birthday" name="birthday">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>开卡时间</div>
                            <div>
                                <input type="text" id="createtime" name="createtime">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>开卡人</div>
                            <div>
                                <input type="text" id="emp" name="emp">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>所属经销商</div>
                            <div>
                                <input type="text" id="dealer" name="dealer">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>年龄</div>
                            <div>
                                <input type="text" id="age" name="age">
                            </div>
                        </div>
                        <div style="float: left" class="query_list">
                            <div>性别</div>
                            <div>
                                <input type="text" id="gender" name="gender">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div style="text-align: left;padding-right: 2%;margin-bottom: 5%">

            <div style="margin: 2%;font-size: 20px;">选择优惠券类型：</div>
            <div style="margin: 2%;">
                <select id="c-type">
                    <option value="123">优惠500</option>
                    <option value="123">优惠1000</option>
                    <option value="123">优惠500</option>
                    <option value="123">优惠1000</option>
                    <option value="123">优惠500</option>
                    <option value="123">优惠1000</option>
                </select>
            </div>
        </div>
        <div id="new" style="height: 33px;margin: 3% 0 0 40%;">
            <a class="btlogin" href="#" onclick="run()">提 交</a>
            <a class="btlogin" href="coupon-t.html" style="background-color: #4cae4c">返 回</a>
        </div>
        <div style="text-align: center; width: 90%;height: 110px;background-color: #e9e9db;color: #1a1a74;border-radius: 15px;
              margin: 4%;border: 3px solid #121f3e;position: relative">
            <div class="sdiv">
                <div>开始时间</div>
                <div id="sdiv_creation" style="font-size: 0.85em" >--</div>
            </div>
            <div class="sdiv">
                <div>结束时间</div>
                <div id="sdiv_endtime" style="font-size: 0.85em" >--</div>
            </div>
            <div class="sdiv">
                <div>总数量</div>
                <div id="sdiv_total">--</div>
            </div>
            <div class="sdiv">
                <div>已完成</div>
                <div id="sdiv_succeed">--</div>
            </div>
            <div class="sdiv">
                <div>未完成</div>
                <div id="sdiv_unfinished">--</div>
            </div>
            <div class="sdiv">
                <div>失败</div>
                <div id="sdiv_defeated">--</div>
            </div>
            <div class="sdiv">
                <div>状态</div>
                <div id="sdiv_state">--</div>
            </div>
        </div>

    </div>

    <div class="row">
        <script type="text/javascript" src="js/angular.min.js"></script>
        <script type="text/javascript" src="js/ui-bootstrap-tpls.min.js"></script>
    </div>
</div>

<div class="clearfix"></div>

</div>

<script src="js/jquery.min.js"></script>

<script src="assets/js/fontawesome-all.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

</body>
<script src="assets/js/jq.page.js"></script>
<script>
    $("#shht-sj,#shht").hover(function () {
        // 鼠标移入时添加hover类

        $("#shht").css('display', 'inline')
    }, function () {
        // 鼠标移出时移出hover类

        $("#shht").css('display', 'none')
    });
</script>
<script>
    (function ($) {
        $.getUrlParam1 = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return decodeURI(r[2]);
            return null;
        }
    })(jQuery);
</script>
<script>
    $(document).ready(
        getType(),
        getState()
    );
    var timeI = setInterval(getState, 1000);

    function getState() {
        $.ajax({
            "url": "/coupon/getbatch/",
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                var data = json.data;
                $("#sdiv_creation").html(data.creation);
                $("#sdiv_endtime").html(data.endtime);
                $("#sdiv_total").html(data.total);
                $("#sdiv_succeed").html(data.succeed);
                $("#sdiv_unfinished").html(data.unfinished);
                $("#sdiv_defeated").html(data.defeated);
                $("#sdiv_state").html(data.state);
            }
        })
    }


    function run() {


        var id = $("#c-type").val();

        $.ajax({
            "url": "/coupon/batch/",
            "data": $("#form-query").serialize() + "&tid=" + id,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                if (json.state == 200) {
                    alert("开始执行")
                } else {
                    alert(json.message)
                }
            }
        })
    }


    function getType() {
        $.ajax({
            "url": "/coupon/gettype/",
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                $("#c-type").empty();
                var list = json.data;
                for (var i = 0; i < list.length; i++) {

                    var html = '<option value="#{id}">#{name}</option>';

                    html = html.replace("#{id}", list[i].id);
                    html = html.replace("#{name}", list[i].name);

                    $("#c-type").append(html);
                }
            }
        })
    }
</script>
<script>
    $("#e-exit").click(function () {
        $(document).ready(
            $.ajax({
                "url": "/backend/exit/",
                "type": "POST",
                "success": function () {

                    location.href = "login-system.html"

                }
            }))
    })
</script>

</html>